import NetAdapter from "../../adpapter/NetAdapter";
import { AlertManager } from "../../alert/AlertManager";
import { MVC } from "../../framework/MVC";
import DeviceManager from "../../manager/DeviceManager";
const { ccclass, property } = cc._decorator;

@ccclass
export default class ShimingView extends MVC.BaseView {
    protected changeListener(enable: boolean): void {
    }

    @property(cc.EditBox)
    idInput: cc.EditBox = null;

    @property(cc.EditBox)
    nameInput: cc.EditBox = null;

    @property(cc.Node)
    maskNode: cc.Node = null;

    onClickShiming() {
        do{
            if(this.idInput.string.length == 0 || this.nameInput.string.length == 0){
                AlertManager.showNormalTips("请输入身份证号和姓名");
                break;
            }
            else{
                NetAdapter.aliShimingRengzheng({id_card_no: this.idInput.string, name: this.nameInput.string}).then(res => {
                    // if(res.code == 0){
                        // AlertManager.showNormalTips("实名认证成功");
                        this.node.active = false;
                    // }
                    AlertManager.showNormalTips(res.msg);
                },(err)=>{
                    console.log(err);
                    // AlertManager.showNormalTips("实名认证失败");
                })
            }
        }
        while(false)
        // this.maskNode.active = true;
        // DeviceManager.inst.zfbOpenAuthScheme(this.idInput.string, this.nameInput.string, () => {
        //     this.maskNode.active = false;
        //     this.onClose();
        // }, () => {
        //     this.maskNode.active = false;
        // })
    }
}